home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ScriptRunnerUtils.cpp
-
- Contains: ScriptRunner utility functions & classes
-
- Written by: Steve Smith
-
- Copyright: © 1994-95 by Apple Computer, Inc., all rights reserved.
- */
-
- // -- OpenDoc Utilities --
-
- #ifndef _EXCEPT_
- #include <Except.h>
- #endif
-
- // --- ScriptRunner Includes ---
-
- #ifndef _SCRIPTRUNNERUTILS_
- #include "ScriptRunnerUtils.h"
- #endif
-
- #ifndef _SCRIPTRUNNERDEF_
- #include "ScriptRunnerDef.h"
- #endif
-
- // --- OpenDoc Includes ---
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdDefs_defined
- #include <StdDefs.xh>
- #endif
-
- // -- OpenDoc Utilities --
-
- #ifndef _ODMEMORY_
- #include <ODMemory.h>
- #endif
-
- #ifndef _STDTYPIO_
- #include <StdTypIO.h>
- #endif
-
- // --- Macintosh Includes ---
-
- #ifndef __GXMATH__
- #include <GXMath.h>
- #endif
-
-
- //====================================================================
- // Utility Functions
- //====================================================================
-
- //--------------------------------------------------------------------
- // FixedToIntRect
- //--------------------------------------------------------------------
-
- void FixedToIntRect(ODRect& fixedRect, Rect& intRect)
- {
- intRect.top = FixedToInt(fixedRect.top);
- intRect.left = FixedToInt(fixedRect.left);
- intRect.bottom = FixedToInt(fixedRect.bottom);
- intRect.right = FixedToInt(fixedRect.right);
- }
-
- //--------------------------------------------------------------------
- // IntToFixedRect
- //--------------------------------------------------------------------
-
- void IntToFixedRect(Rect& intRect, ODRect& fixedRect)
- {
- fixedRect.left = ff(intRect.left);
- fixedRect.top = ff(intRect.top);
- fixedRect.right = ff(intRect.right);
- fixedRect.bottom = ff(intRect.bottom);
- }
-
- //------------------------------------------------------------------------------
- // InvalidateRect
- //------------------------------------------------------------------------------
-
- void InvalidateRect( Environment* ev,
- ODFrame* frame,
- Rect bRect )
- {
- ODRect invalidRect;
- ODShape* invalidShape;
-
- IntToFixedRect(bRect, invalidRect);
-
- invalidShape = frame->CreateShape(ev);
- if(invalidShape)
- {
- invalidShape->SetRectangle(ev, &invalidRect);
-
- frame->Invalidate(ev, invalidShape, kODNULL);
-
- invalidShape->Release(ev);
- }
- }
-